void main() {
  Person s1 = Person('jack', 20);
  Person s2 = Person.withNameAge('tom', 18);

  print("我叫${s1.name},今年${s1.age}岁");
  print("我叫${s2.name},今年${s2.age}岁");
}

class Person {
  // 自定义类名构造函数
  Person(this.name, this.age);

  // 命名构造函数
  // Person.withNameAge(String name, int age) {
  //   this.name = name;
  //   this.age = age;
  // }
  // 简写
  Person.withNameAge(this.name, this.age);

  String? name;
  int? age;
}
